package thread;
//实现runnable，重写run
 class Myrunnable implements Runnable {
    @Override//父类方法没有throws
    public void run() {
        while(true){
            System.out.println("hello thread");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }

    public static void main(String[] args) throws InterruptedException {
        Runnable runnable=new Myrunnable();
        Thread thread=new Thread(runnable);
        thread.start();
        while(true){
            System.out.println("hello main");
            Thread.sleep(1000);
        }
    }
}
